package com.changyue.bleHelper.Resp;

import android.util.Log;

public class BLEResp {
    public byte[] resp = null;

    public static  BLEResp parse(byte[] bytes) {
        String by = new String(bytes);
        Log.d("BLEResp ", by);

        BLEResp ret = null;
        if ("_ok".equalsIgnoreCase(by)) {
            BLETargetTempResp stopResp = new BLETargetTempResp();
            ret = stopResp;
            stopResp.res = by;
        } else if ("_stop".equalsIgnoreCase(by)) {
            BLEStopResp stopResp = new BLEStopResp();
            ret = stopResp;
            stopResp.res = by;
        } else {
            BLEStartResp startResp = new BLEStartResp();
            ret = startResp;
            Integer tempNum = Integer.parseInt(by);
            startResp.temp = tempNum / 100.00f;
        }
        ret.resp = bytes;
        return ret;
    }
}
